#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>
void ShellSort(int* a,int len)
{
	int gap = len;
	while (gap > 1)
	{
		gap = gap / 3 + 1;
		for (int i = 0; i < len - gap; i++)
		{
			int end = i;
			int tem = a[end + gap];
			while (end > 0)
			{
				if (tem < a[end])
				{
					a[end + gap] = a[end];
					end -= gap;
				}
				else
				{
					break;
				}
			}
			a[end + gap] = tem;
		}

	}
}

int main()
{
	int a[] = { 0,34,5,6,2,13,54,65,76 };
	int len = sizeof(a) / sizeof(int);
	ShellSort(a, len);
	for (int i = 0; i < len; i++)
	{
		printf("%d ", a[i]);
	}
	return 0;
}